function initPage(baseInfoJson,infectionInfoJson){
	var basePath = $("#basePath").val();
	
	
	
	$("select").each(function(){
		$(this).append("<option value=''>---请选择---</option>");
	});
	var pathogens = baseInfoJson['pathogens'];//病原体
	$(".pathogenSelect").each(function(){
		var options = "";
		for(var index in pathogens){
			var pathogen = pathogens[index];
	    	options+="<option value='"+pathogen.uniq_code+"'>"+pathogen.label+"</option>"
	    } 
       $(this).append(options);
	});
	
	var pathogenyCheckSpecimens = baseInfoJson['pathogenyCheckSpecimens'];//病原学检测标本
	$(".pathogenyCheckSpecimenSelect").each(function(){
		var options = "";
		for(var index in pathogenyCheckSpecimens){
			var pathogenyCheckSpecimen = pathogenyCheckSpecimens[index];
	    	options+="<option value='"+pathogenyCheckSpecimen.uniq_code+"'>"+pathogenyCheckSpecimen.label+"</option>"
	    } 
       $(this).append(options);
	});
	
	var predisposeFactors = baseInfoJson['predisposeFactors'];//易感因素
	$(".predisposeFactorSelect").each(function(){
		var options = "";
		for(var index in predisposeFactors){
			var predisposeFactor = predisposeFactors[index];
	    	options+="<option value='"+predisposeFactor.uniq_code+"'>"+predisposeFactor.label+"</option>"
	    } 
       $(this).append(options);
	});
	
	var infectionRecords = infectionInfoJson['infectionRecords'];//压疮记录明细集合
	for(var index in infectionRecords){
		var infectionRecord = infectionRecords[index];
		var add_content= addInfectionRecord();
		add_content.find("input[name$='.reportDateTime']").val(infectionRecord.reportDateTime);
		add_content.find("input[name$='.infectDateTime']").val(infectionRecord.infectDateTime);
		if(infectionRecord.pathogenCode){
			var selectOption = add_content.find("select[name$='pathogenCode']").find("option[value='"+infectionRecord.pathogenCode+"']")
			if(selectOption.length > 0){
				selectOption.attr("selected",true);
			}else{
				add_content.find("select[name$='pathogenCode']").append("<option selected='selected' value='"+infectionRecord.pathogenCode+"'>"+infectionRecord.pathogenName+"</option>");
			}
			
		};
		add_content.find("input[name$='.pathogenName']").val(infectionRecord.pathogenName);
		
		
		if(infectionRecord.pathogenyCheckSpecimenCode){
			var selectOption = add_content.find("select[name$='pathogenyCheckSpecimenCode']").find("option[value='"+infectionRecord.pathogenyCheckSpecimenCode+"']")
			if(selectOption.length > 0){
				selectOption.attr("selected",true);
			}else{
				add_content.find("select[name$='pathogenyCheckSpecimenCode']").append("<option selected='selected' value='"+infectionRecord.pathogenyCheckSpecimenCode+"'>"+infectionRecord.pathogenyCheckSpecimenName+"</option>");
			}
			
		};
		add_content.find("input[name$='.pathogenyCheckSpecimenName']").val(infectionRecord.pathogenyCheckSpecimenName);
		
		
		if(infectionRecord.predisposeFactorCode){
			var selectOption = add_content.find("select[name$='predisposeFactorCode']").find("option[value='"+infectionRecord.predisposeFactorCode+"']")
			if(selectOption.length > 0){
				selectOption.attr("selected",true);
			}else{
				add_content.find("select[name$='predisposeFactorCode']").append("<option selected='selected' value='"+infectionRecord.predisposeFactorCode+"'>"+infectionRecord.predisposeFactorName+"</option>");
			}
			
		};
		add_content.find("input[name$='.predisposeFactorName']").val(infectionRecord.predisposeFactorName);
		
	} 
	
	
	
	if($("#infectionRecords tbody tr").length <1){
		addInfectionRecord();
	}
}

function addInfectionRecord(){
	var basePath = $("#basePath").val();
	var infectionCountOjb = $("#infectionRecordCount");
	var count = parseInt(infectionCountOjb.val());
	var add_content=$("#templateInfectionTr").clone();
	add_content.removeAttr("id");
	
	add_content.find("input[name^='infectionRecords[0].']").each(function(){
		var eventObj = $(this);
		eventObj.attr("name",eventObj.attr("name").replace("infectionRecords[0]", "infectionRecords["+count+"]"));
   		
	});
	
	add_content.find("select[name^='infectionRecords[0].']").each(function(){
		var eventObj = $(this);
		eventObj.attr("name",eventObj.attr("name").replace("infectionRecords[0]", "infectionRecords["+count+"]"));
	});
	
	add_content.find("select[class='pathogenSelect']").each(function(){
		$(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	add_content.find("select[class='pathogenyCheckSpecimenSelect']").each(function(){
		$(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	add_content.find("select[class='predisposeFactorSelect']").each(function(){
		$(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	
	$("#infectionRecords tbody").append(add_content);
	infectionCountOjb.val(count +1);
	return add_content;
}

function deleteInfectionRecord(obj){
	$(obj).parent().parent().remove();
}